Найти столбец не содержащий отрицательных элементы — С++(Си)

#include <iostream>
#include <math.h>
#include <time.h>
 
using namespace std;
 
int main()
{
    float matr[5][5];
    int i, j, count;
 
    srand(time(NULL));
    for (i=0; i<5; i++)
    {
        for (j=0; j<5; j++)
        {
            matr[i][j]=rand()%15-5;
            cout.width(3);
            cout << matr[i][j]<<" ";
        }
        cout << endl;
    }
    cout << endl;
    for (j=0; j<5; j++)
    {
        count=0;
        for (i=0; i<5; i++)
            if (matr[i][j]<0) count++;
        if (!count) cout << "Stolbec " << j+1 << " ne soderjit otricatel'nih elementov" << endl;
    }
}

Leave a Comment